/**
 * Copyright 2019-2022 Huawei Technologies Co., Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef FRAMEWORK_GRAH_PERSISTENCE_GRAPH_DEF_H
#define FRAMEWORK_GRAH_PERSISTENCE_GRAPH_DEF_H
#include <string>
#include "func_macro_def.h"

namespace hiai {
class IOpDef;
class IAttrMapDef;

class IGraphDef {
public:
    IGraphDef() = default;
    virtual ~IGraphDef() = default;

    IGraphDef(const IGraphDef&) = delete;
    IGraphDef& operator=(const IGraphDef&) = delete;

    virtual void CopyFrom(const IGraphDef* other) = 0;
    virtual SerializeType GetSerializeType() const = 0;

    virtual bool LoadFrom(const uint8_t* data, size_t len) = 0;
    virtual bool SaveTo(uint8_t* data, size_t len) const = 0;
    virtual size_t GetGraphDefSize() const = 0;

    virtual bool Swap(IGraphDef* other) = 0;

    DEF_PERSISTENCE_STANDARD_MEMBER_PURE_FUNC(std::string, name);
    DEF_PERSISTENCE_STANDARD_LIST_MEMBER_PURE_FUNC(std::string, input);
    DEF_PERSISTENCE_STANDARD_LIST_MEMBER_PURE_FUNC(std::string, output);
    DEF_PERSISTENCE_CUSTOM_LIST_MEMBER_PURE_FUNC(IOpDef, op);
    DEF_PERSISTENCE_CUSTOM_MEMBER_PURE_FUNC(IAttrMapDef, attr);
};

} // namespace hiai

#endif